Expand a Set[Set[String]] into Cartesian Product in Scala
Posted
by huynhjl
on Stack Overflow
See other posts from Stack Overflow
or by huynhjl
Published on 2010-05-23T15:36:59Z
Indexed on
2010/05/23
16:00 UTC
Read the original article
Hit count: 247
I have the following set of sets. I don't know ahead of time how long it will be.
val sets = Set(Set("a","b","c"), Set("1","2"), Set("S","T"))
I would like to expand it into a cartesian product:
Set("a&1&S", "a&1&T", "a&2&S", ..., "c&2&T")
How would you do that?
© Stack Overflow or respective owner